package com.hmall.search.pojo;

import com.hmall.common.dto.ItemDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;


import java.util.ArrayList;
import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ItemDoc {
    private Long id;
    private String name;
    private Long price;
    private String image;
    private String category;
    private String brand;
    private Integer sold;
    private Integer commentCount;
    private Boolean  isAd;
    private List<String> suggestion =new ArrayList<>(23);
    public ItemDoc(ItemDTO itemDTO){
        BeanUtils.copyProperties(itemDTO,this);
        suggestion.add(itemDTO.getBrand());
        suggestion.add(itemDTO.getCategory());
    }

}
